#!/usr/bin/env python
#-*-encoding:utf-8-*-
'''
Created on 2015年6月26日

@author: chenyongbing
'''
import sys,os
#current_dir = os.path.dirname(__file__)
current_dir = os.path.split(os.path.realpath(__file__))[0]

import rbtree,mmh3

redisConfig = [{'host':'192.168.1.201','port':6379},
               {'host':'192.168.1.202','port':6379},
               {'host':'192.168.1.203','port':6379},
               {'host':'192.168.1.204','port':6379},
               ]


def tailMap(map,minKey=0):
    datas={}
    for key,value in map.items():
        print key,value
        if key>=minKey:
            datas[key] = value
    return datas

dd = {}

for n in range(len(redisConfig)):
    for i in range(160):
        key = mmh3.hash('SHARE-%s-NODE-%s'%(n,i))
        dd[key] = n
        
rt = rbtree.rbtree(dd)

datas = tailMap(rt)
print  rbtree.rbtree(datas)
key = 'grp_src_2015-06-25.32011148.08:57:00:1b:a0:a3'
hkey = mmh3.hash(key)
print hkey